#ifndef FERMAT_LIBHTTP_CODEC_HTTP_SETTINGS_H_
#define FERMAT_LIBHTTP_CODEC_HTTP_SETTINGS_H_
#include <fermat/libhttp/codec/setting_id.h>
#include <vector>

namespace fermat {
namespace libhttp {

struct HttpSetting {
	HttpSetting(SettingId i, uint32_t v)
	: id(i),
	  value(v),
	  isSet(true)
	{

	}
	HttpSettings():id(SettingId::kNoSetting), value(0), isSet(false)
	{

	}

	SettingId    id;
	uint32_t     value;
	bool         isSet;
	
};

class HttpSettings{
public:
	HttpSettings();
	HttpSettings(const vector<SettingPair> &init_settings);

	void setSetting(SettingId id, uint32_t val);

	void unsetSetting(SettingId id);

	const HttpSetting* getSetting(SettingId id) const;

	uint32_t getSetting(SettingId, uint32_t defaultVal);

	uint32_t getNumSettings() const;

	const vector<HttpSetting> getAllSetting() const;

	void clear();
private:
	const HttpSetting* findSetting(SettingId id) const;

	HttpSetting* findSetting(SettingId id);
	
private:
	std::vector<HttpSetting>   _settings;
	uint32_t                   _numSetting;
};
}
}
#endif